/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.entities;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;

/**
 *
 * @author ely
 */
@Entity
public class City implements Serializable{
    
    @Id
    @SequenceGenerator(name = "seq_city", sequenceName = "seq_city", allocationSize = 1)
    @GeneratedValue(generator = "seq_city", strategy = GenerationType.SEQUENCE)
    private Long id;
    
    @Column
    private Long cod;
     
    @ManyToOne
    @JoinColumn(name="id_states", nullable=false, updatable=false)
    private States  states;
    
    @Column
    private String name;
    
    

    public City() {
    }

    public City(Long id, States states, String name) {
        this.id = id;
        this.states = states;
        this.name = name;
    }
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public States getStates() {
        return states;
    }

    public void setStates(States states) {
        this.states = states;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getCod() {
        return cod;
    }

    public void setCod(Long cod) {
        this.cod = cod;
    }
    
    

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 79 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final City other = (City) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "City{" + "id=" + id + ", states=" + states + ", name=" + name + '}';
    }
    
    
    
    
}
